<?php
class RedirectExternalLinkForm extends Form
{
    public function __construct()
    {
        parent::Form('RedirectExternalLinkForm');
        
        CGlobal::$website_title = 'Chuyển trang - '.CGlobal::$website_title;
    }

    public function draw()
    {
        global $display;
        
        $url = Url::getParam("url");

        if($url != '' && strpos($url,WEB_ROOT) === 0)
        {
             Url::redirect_url($url);
        }
        elseif($url != '' && ( strpos($url,'http://') === 0 || strpos($url,'https://') === 0 || strpos($url,'ftp://') === 0))
        {
            $display->add("url",$url);
            $display->output('redirect');
            //("refresh:5; url=$url");
        }
        else
        {
            Url::redirect('home');
        }
    }
}
